<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    class Father {
      constructor(uname) {
        this.uname = uname;
        this.say = function () {
          console.log('Father say');
        }
      }
      drink () {
        console.log('Father 喝酒');
      }
    }

    class Son extends Father {
      constructor(uname, age) {
        super(uname)//必须是子构造器的this调用之前
        this.age = age;
        this.talk = function () {
          console.log('son talk');
        }
      }
      playGames () {
        console.log('son playGames');
        super.drink()// super 可以调用父类的原型方法
        super.say()
      }
    }
    var s = new Son('张三', 20);
    console.log(s);
    s.playGames();

  </script>
</body>

</html>